<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // var name = 'window'
    // function showName() {
    //   console.log(name)
    //   // debugger
    //   if (true) {
    //     var name = 'false'
    //   }
    // }
    // showName() // undefined

    function showName() {
      // var name ='host'
      // debugger
      if (false) {
        var name = 'false'
      }
      console.log(name)
      // debugger
    }
    var name
    name ='window'
    showName()

  </script>
</body>

</html>